////////////////////////////////////////////////////////////////////////////////
//
//	This file is part of Woozox, see <http://code.google.com/p/woozox/>.
//
//	Copyright 2008-2009 Florian David
//
//	Woozoo is free software: you can redistribute it and/or modify
//	it under the terms of the GNU Lesser General Public License as 
//	published by the Free Software Foundation, either version 3 of 
//	the License, or (at your option) any later version.
//
//	Woozoo is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU Lesser General Public 
//	License along with Woozoo. If not, see <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
package org.woozoo.xhtml.unittests.selectorsuite.selector
{
	import org.flexunit.asserts.assertTrue;
	import org.woozoo.xhtml.core.base.*;
	import org.woozoo.xhtml.unittests.selectorsuite.CaseBase;

	public class FirstChildCase extends CaseBase
	{
		private var __xml : XML = <root><p>The last P before the note.</p><div class="note"><p>The first P inside the note.</p></div></root>;
		private var __xml2 : XML = <root><p> The last P before the note.</p>
<div class="note">
   <h2> Note </h2>
   <p> The first P inside the note.</p>
</div></root>;
		
		[Test(order=1)]
		public function findElementP() : void {
			createDocumentFromXML(__xml)
			results = document.$$('div > p:first-child');
			assertTrue(hasResultsAndLenEqual(1) && getFirstElement().innerHTML == 'The first P inside the note.');
		}
		[Test(order=2)]
		public function findElementNoP() : void {
			createDocumentFromXML(__xml2)
			results = document.$$('div > p:first-child');
			assertTrue(hasResultsAndLenEqual(0));
		}
	}
}